 <!-- Example table --> <div class="container_12"> 
      <div class="module">
                     <h2><span>Add Venue Tariff</span></h2>
                        
                     <div class="module-body">
                         <div style="margin-top:13px;">
                        <?php
                        if(isset($errMsg)){?>
                        <span class="notification"><?php echo $_MESSESGE[$errMsg];?></span>
                        <?php }?></div>
                        
                        <form action="" name="admin_frm" id="admin_frm" method="post" enctype="multipart/form-data">
                            <p>                                
                                <label>Select Vendor</label>
                                <?php   
                                $vendor = Vendor::getVendor();
                                if( $vendor ){  
                                    echo '<select class="input-short" name="vendor" id="vendor_id" >';
                                    $selval = $_POST['vendor'];
                                    echo '<option value="">Select Vendor</option>';
                                    foreach( $vendor as $row )  {
                                        $sel = $selval==$row['id'] ? 'selected' : '';
                                        echo '<option value="'.$row['id'].'" '.$sel.'>'.$row['name'].'</option>';
                                    }   
                                    echo '</select>';
                                }                                                        
                                ?>
                            </p>
                            <p>
                                <label>Fixed Cost Items</label>
                                <select class="input-short" name="fixed_cost_items[]" id="fixed_cost_items" multiple></select>
                            </p>
                            <p>
                                <label>Variable Cost Items</label>
                                <select class="input-short" name="variable_cost_items[]" id="variable_cost_items" multiple></select>
                            </p>
                            <p>
                                <label>Venue</label>
                                <select id="venue_id" name="venue" style="width:150px;">
                                    <option value="">Select Venue</option>
                                </select>
                            </p>
                            <p>
                                <label>Name</label>
                                <div id="availability_info"></div>
                                <input type="text" class="input-short check_availability" name="name" value="<?php echo $_POST['name'];?>" />
                                <!--  <span class="notification-input ni-correct">This is correct, thanks!</span> -->
                            </p>  
                            <p>
                                <label>From Date</label>
                                <input name="from_date" type="text"  class="inputText" value="<?php echo $_POST['from_date']?>" size="10"/><a href="javascript:showCal('Calendar1')"><img src="<?php echo _SITE_ADMIN_URL_;?>images/calendar.jpg" alt="Click Here to Pick up the date" border="0" /></a>
                                <!-- <span class="notification-input ni-error">Sorry, try again.</span> -->
                            </p>
                            <p>
                                <label>To Date</label>
                                <input name="to_date" type="text"  class="inputText" value="<?php echo $_POST['to_date']?>" size="10"/><a href="javascript:showCal('Calendar2')"><img src="<?php echo _SITE_ADMIN_URL_;?>images/calendar.jpg" alt="Click Here to Pick up the date" border="0" /></a>
                                <!-- <span class="notification-input ni-error">Sorry, try again.</span> -->
                            </p>
                            <p>
                                <label>Base Price</label>                                
                                <input type="text" class="input-short" name="total_cost" id="total_cost" value="<?php echo $_POST['total_cost'];?>">
                            </p>
                            <p>
                                <label>Person Allowed in Base Price</label>                                
                                <input type="text" class="input-short" name="no_of_people" id="no_of_people" value="<?php echo $_POST['no_of_people'];?>">
                            </p>
                            <p>
                                <label>Per Person Cost (When person exceed the base limit)</label>                                
                                <input type="text" class="input-short" name="per_person_cost" id="per_person_cost" value="<?php echo $_POST['per_person_cost'];?>">
                            </p>
                            <p>
                                <label>Discount Type</label>
                                <input type="radio" name="discount_type" value="1" <?php echo ($_POST['discount_type'] == 1)?'checked':''; ?>>Flat &nbsp;
                                <input type="radio" name="discount_type" value="2" <?php echo ($_POST['discount_type'] == 2)?'checked':''; ?>>Percentage
                            </p>
                            <p>
                                <label>Discount</label>
                                <input type="text" class="input-short" name="discount" id="discount" value="<?php echo $_POST['discount'];?>">
                            </p>
                            <p>
                                <label>Surcharge Type</label>
                                <input type="radio" name="surcharge_type" value="1" <?php echo ($_POST['surcharge_type'] == 1)?'checked':''; ?>>Flat &nbsp;
                                <input type="radio" name="surcharge_type" value="2" <?php echo ($_POST['surcharge_type'] == 2)?'checked':''; ?>>Percentage
                            </p>
                            <p>
                                <label>Surcharge</label>
                                <input type="text" class="input-short" name="surcharge" id="surcharge" value="<?php echo $_POST['surcharge'];?>">
                            </p>
                            <p>
                                <label>Tax Rate</label>
                                <input type="text" class="input-short" name="tax_rate" id="tax_rate" value="<?php echo $_POST['tax_rate'];?>">
                            </p>
                            <p>
                                <label>Booking Amount</label>
                                <input type="text" class="input-short" name="booking_amount" id="booking_amount" value="<?php echo $_POST['booking_amount'];?>">
                            </p>
                            <p>
                                <label>Cancellation Policy</label>
                                <textarea rows="7" cols="90" class="input-short" id="cancellation_policy" name="cancellation_policy"><?php echo $_POST['cancellation_policy']; ?></textarea>
                            </p>
                            <p>
                                <label>Terms & Conditions</label>
                                <textarea rows="7" cols="90" class="input-short" id="tc_policy" name="tc_policy"><?php echo $_POST['tc_policy']; ?></textarea>
                            </p>
                            <fieldset>
                                <input class="submit-green" type="submit" name="submit" value="Submit" /> 
                               <input class="submit-gray" type="button" value="Cancel" onclick="javascript: window.location='<?php echo _SITE_ADMIN_URL_?>'+'venue/venuetariff_mng.php';" />
                            </fieldset>
                        </form>
                     </div> <!-- End .module-body -->

                </div>  <!-- End .module -->
                </div>
                <div style="clear:both;"></div>

<script language="javascript">
addCalendar("Calendar1", "Select Date", "from_date", "admin_frm");
addCalendar("Calendar2", "Select Date", "to_date", "admin_frm");
setFormat("yyyy-mm-dd");
</script>                              
<script type="text/javascript">
    var root_path = '<?php echo _SITE_ADMIN_URL_?>';
    var table = 'venue_tariff';
    var field = 'name';

    function get_vendor_services(vendor_id){
        path = root_path+'ajax/getGeo.php?id='+vendor_id+'&type=vendor_services';
        $.ajax({url: path,  
            success: function(response) {
                $('#fixed_cost_items').html(response);
            }
        });
    }

    function get_all_services(){
        path = root_path+'ajax/getGeo.php?type=all_services';
        $.ajax({url: path,  
            success: function(response) {
                $('#variable_cost_items').html(response);
            }
        });
    }

    function get_vendor_tc_cancellation(_id){
        //var _id = $(this).val();
        path = root_path+'ajax/getGeo.php?id='+_id+'&type=tc_cancellation';
        $.ajax({url: path,  
            success: function(response) {
                var _response = response.split('##');
                var tc_policy = _response[0];
                var cancellation_policy = _response[1];
                $('#tc_policy').html(tc_policy);
                $('#cancellation_policy').html(cancellation_policy);
            }
        });
    }

    $().ready(function() {
        $('#vendor_id').change(function(){
            var vendor_id = $(this).val();
            path = root_path+'ajax/getGeo.php?id='+vendor_id+'&type=vendor_venue';
            $.ajax({url: path,  
                success: function(response) {
                    $('#venue_id').html(response);
                    get_vendor_services(vendor_id);
                    get_all_services();
                    get_vendor_tc_cancellation(vendor_id)
                }
            });
        });

        /*$('#venue_id').change(function(){
            var _id = $(this).val();
            path = root_path+'ajax/getGeo.php?id='+_id+'&type=venue_tc_cancellation';
            $.ajax({url: path,  
                success: function(response) {
                    var _response = response.split('##');
                    var tc_policy = _response[0];
                    var cancellation_policy = _response[1];
                    $('#tc_policy').html(tc_policy);
                    $('#cancellation_policy').html(cancellation_policy);
                }
            });
        });*/

        $("#admin_frm").validate({
            rules: {
                venue: "required",
                name: "required",
                from_date: "required", 
                to_date: "required",           
                booking_amount: "required",
                total_cost: {
                    required: true,
                    number: true
                },
                no_of_people: {
                    required: true,
                    digits: true
                },
                per_person_cost: "number"
            },
            messages: {
                vendor: "Please select the venue",
                name: "Please enter tariff name",
                from_date: "Please Enter from date",
                to_date: "Plase Enter to date",            
                booking_amount: "Please enter booking amount",
                total_cost: "Enter base price.",
                no_of_people: "Enter number of people allowed in base price.",
                per_person_cost: "Ener per person cost."            
            }
        });
    });
</script>  
<script type="text/javascript" src="<?php echo _ADMIN_JS_; ?>check_availability.js"></script>